#ifndef SNAKESERVER_H
#define SNAKESERVER_H

#include <QObject>
#include <QTimer>
#include <Qt/qtcpserver.h>
#include <Qt/qtcpsocket.h>
#include <QMap>
#include <QVector>
#include <QDebug>
#include <QString>

#include "snakegame.h"

class SnakeServer : public QObject
{
    Q_OBJECT
private:
    QTimer *timer;
    QTcpServer *server;
    QMap<quint32, QTcpSocket *> clients;
    SnakeGame *game;
    QVector<bool > freeplace;
    QString curMsg;
    quint32 time;

    void sendToClient(quint32 ID, QString msg);

public:
    explicit SnakeServer(QObject *parent = 0);
    
signals:
    
public slots:
    void slotNewConnection();
    void slotReadyRead();
    void slotTimeout();
    void slotDisconected();
};

#endif // SNAKESERVER_H
